#include "CMain.h"

bool CMain::init()
{
	return true;
}

bool CMain::run()
{
	for (VECTOR_TASK::iterator iter = m_vecTasks.begin(); iter != m_vecTasks.end(); ++iter)
	{
		(*iter)->run();
	}
	return true;
}

void CMain::uninit()
{
}

bool CMain::addTask(ITask* ptask)
{
	if(ptask == NULL)
	{
		return false;
	}
	m_vecTasks.push_back(ptask);
	return true;
}

bool CMain::delTask(unsigned int taskId)
{
	for (VECTOR_TASK::iterator iter = m_vecTasks.begin(); iter != m_vecTasks.end(); ++iter)
	{
		if ((*iter)->getTaskId() == taskId)
		{
			m_vecTasks.erase(iter);
			return true;
		}
	}
	return false;
}
